<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>首页</title>
    <link rel="stylesheet" href="../../css/api.css">

    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../css/vant.css">
    <!-- 引入样式 -->
</head>

<body>
    <div class="app" v-cloak>
        <div class="diqusousuo">
            <div class="city-list">
                <van-list v-model="loading" :finished="finished" :error="errorStatus" finished-text="没有更多了">
                    <van-cell v-for="(city, index) in searchedList" @click="selectCity(city)" :key="index" :title="city.name" />
                </van-list>
            </div>
        </div>
    </div>

    </div>
    <script src="../../script/api.js "></script>
    <script src="../../script/flexible.js "></script>
    <script src="../../script/fastclick.js "></script>
    <script src="../../script/vue.min.js "></script>
    <script src="../../script/iconfont.js "></script>
    <script src="../../script/vant.min.js"></script>


    <script>
        apiready = function() {
            api.addEventListener({
                name: 'searchCityByKeyword'
            }, function(ret) {
                console.log(JSON.stringify(ret))
            })
            var vm = new Vue({
                el: '.app',
                data() {
                    return {
                        value: undefined,
                        loading: false,
                        finished: true,
                        errorStatus: false,
                        searchedList: [{
                            name: "北京"
                        }, {
                            name: "上海"
                        }]
                    }
                },

                conponents: {

                },
                created() {

                },

                mounted() {

                },
                methods: {
                    searchCity() {
                        fnGet(interfaces.CONTENT_MODULE.AREA.GET_CITYLIST_BYKEYWORD, {
                                keyword: vm.value
                            }, false,
                            function(ret, err) {
                                console.log(JSON.stringify(ret))
                                if (ret && ret.code === RESPONSE_OK) {
                                    api.sendEvent({
                                        name: 'searchCityByKeyword',
                                        extra: {
                                            cityList: ret.data

                                        }
                                    });
                                } else
                                    toastBottom(ret ? ret.msg : '');
                                console.log(JSON.stringify(that.newsDetail))
                            }
                        );
                    },

                    selectCity(item) {
                        api.sendEvent({
                            name: 'selectedCity',
                            extra: {
                                city: item,
                                previousPage: this.previousPage

                            }
                        });
                        this.backPage();
                    },
                    backPage() {
                        api.closeFrame();

                    },

                }

            })


        }
    </script>
</body>

</html>